#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>

#define N_NUM 1000000
int a[N_NUM];
long long sum;
int main()
{
    for(int i = 0; i<N_NUM; i++)
        a[i] = i;
    
    struct timespec start,end;
    clockid_t cpu_clock;
    clock_getcpuclockid(0,&cpu_clock);
    clock_gettime(cpu_clock,&start);
    for(int i = 0; i<N_NUM; i++)
        sum += a[i];
    // pid = (int)getpid();
    clock_gettime(cpu_clock,&end);
    // printf("get %lld, used %ld ns + %lds \n",sum,end.tv_nsec-start.tv_nsec
    //     ,(long)end.tv_sec - (long)start.tv_sec);

    printf("%ld",end.tv_nsec-start.tv_nsec);
    return 0;
}